import { type DialogModel } from '../type/BaseType'
import { reactive } from 'vue'

export default function useDialog() {
    // 定义弹框属性
    const dialog = reactive<DialogModel>({
        title: '',
        visible: false,
        width: 630,
        cancelButtonText: '关闭',
        confirmButtonText: '确定'
    })

    // 展示
    const onDialogShow = () => {
        dialog.visible = true
    }

    // 关闭
    const onDialogClose = () => {
        dialog.visible = false
    }

    // 确定
    const onDialogConfirm = () => {
        dialog.visible = false
    }

    return {
        dialog,
        onDialogShow,
        onDialogClose,
        onDialogConfirm
    }
}